import {onMounted, ref,} from 'vue'

 const useXY:any = ()=>{
    const x = ref(0)
    const y = ref(0)

    const move = (e:MouseEvent)=>{
        x.value = e.clientX
        y.value = e.clientY
    }

    const click = (e:any)=>{
        x.value = e.pageX
        y.value = e.pageY
    }

    onMounted(()=>{
        window.addEventListener('mousemove',move)

        window.addEventListener('click',click)
    })

    return  {
        x,y
    }
}
export default useXY